const express = require('express');
const router = express.Router();
const service = require("../service/userTelService")
const PATH = "/userTel"


router.get('/hello', function (req, res) {
    res.send('Hello World');
 })

//  router.get('/queryAll', function (req, res) {
//     let data = service.queryAll();
//     data.then((data) => {
//         res.json(data);
//     });
//     // res.send('Hello World');
//     // let data = {success:true}
    
//  })

router.get('/queryAll', async (req, res) =>  {
    let data = await service.queryAll();
        res.json(data);

 })

router.post('/queryAllDemo2', async (req, res) =>  {
    let data = await service.queryAllDemo2(req.body);
    res.json(data);

 })

 router.post('/queryAllByPage',async (req, res) =>  {
    console.log(req.body);
    let data = await service.queryAllByPage(req.body);
    res.json(data);
 })

 module.exports = (app)=> {
    app.use(PATH,router);
}